package flagTest

import (
	"flag"
	"fmt"
)

var (
	isBool bool
	sss    map[int]func() testInterface = make(map[int]func() testInterface)
	s      *string
	s1     map[int]testInterface = make(map[int]testInterface)
)

type testInterface interface {
	test(string)
}

type t1 struct {
}

func (t *t1) test(s string) {
	fmt.Println(s)
}

func init() {

	sss[0] = func() testInterface { return new(t1) }
	s1[0] = new(t1)

	flag.BoolVar(&isBool, "b", false, "can Run")
	s = flag.String("x", "", "??User X")
}

func flagTest() {
	flag.Parse()
	fmt.Println(*s)
	fmt.Println(isBool)
	if isBool {
		fmt.Println("test....")
	}
}

func interfaceTest() {

	s2 := s1[0]
	s2.test("222222")
	fmt.Println("--------------")

	t := sss[0]
	t().test("111")
}
